import {
  type History,
  createBrowserHistory,
} from 'history'
import { type Listener } from '@remix-run/router/dist/history'

export interface CompatibleHistory extends History {
  createURL: (to: any) => any;
  encodeLocation: (to: any) => any;
  listen: (listener: Listener) => () => void; // 使用 @remix-run/router 的 Listener 类型
}

export const history = createBrowserHistory({ window }) as CompatibleHistory
